const {Bill} = require("../model/model.js");

const BillDao = {
    save(positionInfo){
        // console.log(positionInfo);
        const bill = new Bill(positionInfo);
        return bill.save();
    },

    findbyPage(page){
        page = page || 1;
        const pageSize = 5;
        return Bill.find({}).limit(pageSize).skip((page - 1) * pageSize);
    },

    delete(deleteInfo){
        return Bill.remove(deleteInfo);
    },
    update(_id,updateInfo){
        return Bill.update({"_id":_id},{$set:updateInfo});
    },
    find(condition){
        return Bill.find(condition);
    }
}

module.exports = BillDao;